﻿@using McsWeb.Models;
@{ 
    var entity = ViewBag.entity as StaffsModel;
    Layout = null;
}

<!DOCTYPE html>


<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link href="~/Content/Css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="~/Content/Css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="~/Content/Css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="~/Content/Css/animate.css" rel="stylesheet">
    <link href="~/Content/Css/style.css?v=4.1.0" rel="stylesheet">
    <title>Insert</title>
    <link href="/Content/Css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="~/Content/common.css" rel="stylesheet">
    <link href="~/Content/Css/plugins/multiselect/bootstrap-multiselect.css" rel="stylesheet" />
    <style>
        /*.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12,
        .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12,
        .btn-group, #commissionBtn, #clone {
            border-style: solid;
            border-width: 1px;
            border-color: #000;
        }*/
        #RoleIDLaber {
            padding: 8px 0 0 0;
        }

        .padding {
            padding: 0 0 0 0;
        }
    </style>
</head>
<body>
    <div class="wrapper wrapper-content animated fadeInRight">
        <form class="form-horizontal m-t" id="mainForm">

            <input type="hidden" id="ID" name="ID" value=@entity.ID />

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-2 control-label padding">姓名：</label>
                        <div class="col-xs-10">
                            <input id="Name" name="Name" type="text" class="form-control"  value=@entity.Name>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写姓名</span>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-2 control-label" id="RoleIDLaber">角色：</label>
                        <div class="col-xs-10">
                            <select class="form-control" name="RoleID" id="RoleID">
                                <option value='0' @(entity.RoleID == 0?"selected":"")>全部</option>
                                <option value='1' @(entity.RoleID == 1?"selected":"")>管理员</option>
                                <option value='2' @(entity.RoleID == 2?"selected":"")>业务员</option>
                            </select>
                        </div>
                        <span class="help-block m-b-none" id="Rolespan"><i class="fa fa-info-circle"></i>请选择角色</span>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-2 control-label padding">用户名：</label>
                        <div class="col-xs-10">
                            <input id="LoginName" name="LoginName" type="text" class="form-control" value=@entity.LoginName>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写用户名</span>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-2 control-label padding">密码：</label>
                        <div class="col-xs-10">
                            <input id="LoginPass" name="LoginPass" type="text" class="form-control" value=@entity.LoginPass>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写密码</span>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-2 control-label padding">QQ1：</label>
                        <div class="col-xs-10">
                            <input id="QQ1" name="QQ1" type="text" class="form-control" value=@entity.QQ1>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写QQ1</span>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-2 control-label padding">QQ2：</label>
                        <div class="col-xs-10">
                            <input id="QQ2" name="QQ2" type="text" class="form-control" value=@entity.QQ2>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写QQ2</span>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-2 control-label padding">QQ3：</label>
                        <div class="col-xs-10">
                            <input id="QQ3" name="QQ3" type="text" class="form-control" value=@entity.QQ3>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写QQ3</span>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-2 control-label padding">微信1：</label>
                        <div class="col-xs-10">
                            <input id="weixin1" name="weixin1" type="text" class="form-control" value=@entity.WeiXin1>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写微信1</span>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-2 control-label padding">微信2：</label>
                        <div class="col-xs-10">
                            <input id="weixin2" name="weixin2" type="text" class="form-control" value=@entity.WeiXin2>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写微信2</span>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-2 control-label padding">微信3：</label>
                        <div class="col-xs-10">
                            <input id="weixin3" name="weixin3" type="text" class="form-control" value=@entity.WeiXin3>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写微信3</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group" style="margin-bottom:0px;padding-top:20px">
                        <div class="col-xs-3">
                        </div>
                        <div class="col-xs-9">
                            <button id="submit" class="btn btn-primary pull-right" type="submit">
                                <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>


    <!-- 全局js -->
    <script type="text/javascript" src="~/Scripts/jquery.min.js?v=2.1.4"></script>
    <script type="text/javascript" src="~/Scripts/bootstrap.min.js?v=3.3.6"></script>
    <!-- jQuery Validation plugin javascript-->
    <script type="text/javascript" src="~/Scripts/plugins/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="~/Scripts/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript" src="~/Scripts/Extensions/ExtValidator.js"></script>

    <!-- layer javascript -->
    <script type="text/javascript" src="~/Scripts/plugins/layer/layer.min.js"></script>
    <script src="/Scripts/plugins/iCheck/icheck.min.js"></script>

    <script src="~/Scripts/plugins/multiselect/bootstrap-multiselect.js"></script>

    <script type="text/javascript">
        $(function () {
            var icon = "<i class='fa fa-times-circle'></i> ";
            var validator = $("#mainForm").validate({
                rules: {
                    Name: { required: true, },
                    LoginName: { required: true, },
                    LoginPass: { required: true, },
                },
                messages: {
                    Name: { required: icon + "请输入姓名", },
                    LoginName: { required: icon + "请输入用户名", },
                    LoginPass: { required: icon + "请输入密码", },
                },
                submitHandler: function (form) {
                    if ($('#RoleID').val() == '0') {
                        $('#Rolespan').text('请选择角色');
                        $('#Rolespan').addClass("fa fa-times-circle");
                        $("#Rolespan").css({ color: "red" });
                        $("#Rolespan").show();
                    } else {
                    $.ajax({
                        url: "/Staffs/EditAsync",
                        type: "post",
                        dataType: "json",
                        data: $('#mainForm').serialize(),
                        success: function (data) {
                            //Info,Success,Warning,Error
                            var type = data.type;
                            if (type == 1) {
                                layer.msg(data.content, { icon: 6, time: 2000 },
                                    function () {
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                    });

                            } else {
                                layer.msg(data.content, { icon: 5, time: 2000 });
                            }
                        }
                        });
                    }
                }
            });
        });

    </script>
</body>
</html>
